using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_BaseDataItemMap : EntityTypeConfiguration<t_BaseDataItem>
    {
        public t_BaseDataItemMap()
        {
            // Primary Key
            this.HasKey(t => t.FItemClassID);

            // Properties
            this.Property(t => t.FItemClassID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNumber)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.FName)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FName_cht)
                .HasMaxLength(255);

            this.Property(t => t.FName_en)
                .HasMaxLength(255);

            this.Property(t => t.FSQLTableName)
                .HasMaxLength(30);

            this.Property(t => t.FBrNo)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.FRemark)
                .HasMaxLength(80);

            this.Property(t => t.FModifyTime)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(8)
                .IsRowVersion();

            // Table & Column Mappings
            this.ToTable("t_BaseDataItem");
            this.Property(t => t.FItemClassID).HasColumnName("FItemClassID");
            this.Property(t => t.FNumber).HasColumnName("FNumber");
            this.Property(t => t.FName).HasColumnName("FName");
            this.Property(t => t.FName_cht).HasColumnName("FName_cht");
            this.Property(t => t.FName_en).HasColumnName("FName_en");
            this.Property(t => t.FSQLTableName).HasColumnName("FSQLTableName");
            this.Property(t => t.FVersion).HasColumnName("FVersion");
            this.Property(t => t.FImport).HasColumnName("FImport");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FUserDefilast).HasColumnName("FUserDefilast");
            this.Property(t => t.FType).HasColumnName("FType");
            this.Property(t => t.FGRType).HasColumnName("FGRType");
            this.Property(t => t.FRemark).HasColumnName("FRemark");
            this.Property(t => t.FModifyTime).HasColumnName("FModifyTime");
            this.Property(t => t.FGrControl).HasColumnName("FGrControl");
            this.Property(t => t.UUID).HasColumnName("UUID");
        }
    }
}
